<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>列表</title>
    <link href="/resource/bootstrap4/css/bootstrap.css" rel="stylesheet">
    <script type="text/javascript" src="/resource/js/jquery-3.2.1.js"></script>
    <script src="/resource/bootstrap-treeview/js/bootstrap-treeview.js"></script>
    <script src="/resource/bootstrap4/js/bootstrap.js"></script>
</head>
<body>
<form method="post" action="/update">
    id:<input type="text" name="gid" value="${g.gid}"><br>
    gname:<input type="text" name="gname" value="${g.gname}"><br>
    createTime:<input type="date" name="createTime" value="<fmt:formatDate value="${g.createTime}" pattern="yyyy-MM-dd"></fmt:formatDate>"><br>
    updateTime:<input type="date" name="updateTime" value="<fmt:formatDate value="${g.updateTime}" pattern="yyyy-MM-dd"></fmt:formatDate>"><br>
    cid:<select name="cid">
    <option value="">===请选择==</option>
</select><br>
    <input type="submit" value="修改">
</form>
<script>
    $.ajax({
        type:"post",
        url:"/listcate",
        date:{},
        success:function (obj) {
            for(var i in obj){
                $("[name=cid]").append(" <option value='"+obj[i].cid+"'>"+obj[i].cname+"</option>")
            }
            $("[name=cid]").val('${g.cid}')
        }
    })
</script>
</body>
</html>
